﻿<UserControl x:Class="Tum.PDE.LanguageDSL.Visualization.View.Optimization.ConversionModelControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             xmlns:ctrl="clr-namespace:Tum.PDE.LanguageDSL.Visualization"
             xmlns:dc="clr-namespace:Tum.PDE.LanguageDSL.Visualization.View.Controls"
             
             TextOptions.TextFormattingMode="Display" >
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Tum.PDE.LanguageDSL.Visualization;component/Resources/Styles/TabItemStyle.xaml"/>

                <!-- Domain model style -->
                <ResourceDictionary Source="/Tum.PDE.LanguageDSL.Visualization;component/Resources/Styles/DomainModelTreeStyle.xaml"/>

                <!-- Menu item style -->
                <ResourceDictionary Source="/Tum.PDE.LanguageDSL.Visualization;component/Resources/Styles/MenuItemStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>


            <Style TargetType="{x:Type ItemsControl}" x:Key="RootItemsControlModified">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ItemsControl}">
                            <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                                <dc:DesignerCanvas SelectedItems="{Binding Path=SelectedItems, Mode=TwoWay}"
                                             ContextMenuOptions="{Binding Path=Operations, Mode=OneWay}"
                                             HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                             Background="Transparent"
                                             Focusable="True">
                                    <dc:DesignerCanvas.ContextMenu>
                                        <ContextMenu ItemContainerStyleSelector="{StaticResource ContextMenuItemStyleSelector}"/>
                                    </dc:DesignerCanvas.ContextMenu>
                                    <ItemsPresenter Margin="0,0,1000,2000"/>
                                </dc:DesignerCanvas>
                            </ScrollViewer>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Background="White" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <ItemsControl Margin="0, 0, 0, 0" 
                          ItemsSource="{Binding Path=RootNodes, Mode=OneWay}" 
                          ItemTemplate="{StaticResource RootElementsTemplate}"
                          Style="{StaticResource RootItemsControlModified}">
        </ItemsControl>
    </Grid>
</UserControl>
